public class Draw {
    private int height;

    public Draw(int height) {
        this.height = height;
    }

    public void drawTriangle() {
        System.out.println("绘制三角形：");
        for (int i = 1; i <= height; ++i) {
            for (int j = 0; j < i; ++j) {
                System.out.print("*");
            }
            System.out.println();
        }
    }

    public void drawRectangle() {
        System.out.println("绘制矩形：");
        for (int i = 0; i < height; ++i) {
            for (int j = 0; j < height * 2; ++j) {
                System.out.print("*");
            }
            System.out.println();
        }
    }

    public void drawSquare() {
        System.out.println("绘制方形：");
        for (int i = 0; i < height; ++i) {
            for (int j = 0; j < height; ++j) {
                System.out.print("*");
            }
            System.out.println();
        }
    }

    public void drawParallelogram() {
        System.out.println("绘制平行四边形：");
        for (int i = 0; i < height; ++i) {
            for (int j = 0; j < i; ++j) {
                System.out.print(" ");
            }
            for (int j = 0; j < height; ++j) {
                System.out.print("*");
            }
            System.out.println();
        }
    }

    public static void main(String[] args) {
        Draw drawObj = new Draw(8);
        drawObj.drawTriangle();
        drawObj.drawRectangle();
        drawObj.drawSquare();
        drawObj.drawParallelogram();
    }
}
